package chapter05

/**
 * 函数和方法的定义
 */
object Test01_FunctionAndMethod {

  //定义对象的方法
  def sayHi(name: String): Unit = {
    println("hi " + name)
  }


  //定义返回值的方法
  def sayHello(name: String): String = {
    println(name)
    return "Hello"
  }


  def main(args: Array[String]): Unit = {

    //1、定义函数
    def sayHi(name: String): Unit = {
      println("hi " + name)
    }

    sayHi("hello")

    //2、对象调用方法
    Test01_FunctionAndMethod.sayHi("boolo")
    val hello = Test01_FunctionAndMethod.sayHello("Hello")
    println("返回值：" + hello)
  }
}
